﻿<?php
$v_number_of_af = sizeof($arr_all_af); 	// So tthc lay ra duoc
$v_current_style_name = "odd_row";
$v_next_style_name="";
?>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="page_title">
		<td colspan="2"><?php echo CONST_AF_SEARCH_BY_CATE_LABEL,">>".$v_cate_name;?></td>
	</tr>
	<tr class="category_title">
		<td colspan="2"><?php echo $v_agency_name;?></td>
	</tr>	
	<tr><td height="10"></td></tr>
</table><?php

if ($v_number_of_af>0){?>
	<table class="list_table" width="100%" cellpadding="0" cellspacing="0">
	<col width="10%"><col width="85%"><col width="5%">		
		<tr class="header">
			<td align="center"><?php echo CONST_AF_ORDER; ?></td>
			<td align="center"><?php echo CONST_AF_NAME_LABEL; ?></td>
		</tr>
		<?php
		$stt=($page-1)*$limit;			
		for($v_index = 0; $v_index < $v_number_of_af ; $v_index++){
			$v_af_stt= $arr_all_af[$v_index]['0'];
			$v_af_id = $arr_all_af[$v_index]['1'];
			$v_af_name = $arr_all_af[$v_index]['2'];			
			$v_url = "index.php?fuseaction=DISPLAY_SINGLE_AF&v_session=".$v_session."&af_id=" . $v_af_id;
						
			if ($v_current_style_name == "odd_row"){
				$v_current_style_name = "round_row";
			}else{
				$v_current_style_name = "odd_row";
			}
			$stt += 1;		
			?>		
				<tr class="<?php echo $v_current_style_name ?>"> 
					<td align="center">
						<a href="<?php echo $v_url;?>"><?php echo $stt;?></a>
					</td>				
					<td align="left">
					<img src="<?php echo $_ISA_IMAGE_URL_PATH?>doc.gif">
						<a href="<?php echo $v_url;?>"><?php echo $v_af_name;?></a>
					</td>					
				</tr>			
			<?php 
		}
		
	if ($v_current_style_name == "odd_row"){
	$v_next_style_name = "round_row";
	}else{
		$v_next_style_name = "odd_row";
	}
		echo _add_empty_row($v_number_of_af,CONST_LIMIT_AF_PAGE,$v_current_style_name,$v_next_style_name,2);
		?>
	</table>
<?php
}else{
		echo CONST_NO_AF_MESSAGE;
}?>
<table>
	<tr>
		<col width="5%"><col width="95%">
		<td align="center" class="normal_label">
			<b>
			<?
			if ($v_total_af_count > $v_limit) 
			{//(*)
			if ($page == 1)  
				echo "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-left.jpg align=center>"; 
			else            
				echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_AF_BY_AGENCY&v_session=".$v_session."&agency_id=" .$v_agency_id. "&cate_id=".$v_cate_id."&page=".($page - 1). "\">". "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-left.jpg align=center>" . "</a>";
			
			for ($i = 1; $i <= $pager->numPages; $i++) { 
				echo " | "; 
				if ($i == $pager->page)
					echo $i; 
				else 
					 echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_AF_BY_AGENCY&v_session=".$v_session."&agency_id=" .$v_agency_id. "&cate_id=".$v_cate_id. "&page=". $i. "\">". $i."</a>";
				}//dong for
			
			if ($page == $pager->numPages) 
				echo " | ". "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-right.jpg align=center>"; 
			else            
				echo " | ". "<a href=\"index.php?fuseaction=DISPLAY_ALL_AF_BY_AGENCY&v_session=".$v_session."&agency_id=" .$v_agency_id."&cate_id=".$v_cate_id. "&page=".($page + 1) . "\">" . "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-right.jpg align=center>" . "</a>";
			}
			?>
			</b>
		</td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td align="center"><a class="normal_button" href="<?php echo $_URL_BACK?>"><?php echo _CONST_BACK_BUTTON; ?></a></td>
	</tr>
</table>
